package com.yinda.dt.produce.module.jpush;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.yinda.dt.produce.R;
import com.yinda.dt.produce.app.DemoConfig;
import com.yinda.dt.produce.module.login.LoginActivity;

public class PushMessageActivity extends AppCompatActivity implements View.OnClickListener {

    TextView tv_title;
    TextView tv_content;
    TextView tv_left;
    TextView tv_right;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_push_message);

        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_content = (TextView) findViewById(R.id.tv_content);
        tv_left = (TextView) findViewById(R.id.tv_title);
        tv_left.setOnClickListener(this);
        tv_right = (TextView) findViewById(R.id.tv_right);
        tv_right.setOnClickListener(this);

        tv_title.setText(getIntent().getStringExtra("title"));
        tv_content.setText(getIntent().getStringExtra("content"));

    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.tv_left) {
            finish();
        }
        if (id == R.id.tv_right) {
            if (DemoConfig.getInstance(this).isLogin()) {

//                Intent intent = new Intent(this, OrderDetailActivity.class);
//                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                intent.putExtra("id", getIntent().getStringExtra("orderId"));
//                intent.putExtra("orderType", getIntent().getStringExtra("orderType"));
//                intent.putExtra("approvalCode", getIntent().getStringExtra("approvalCode"));
//                intent.putExtra("isReview", getIntent().getBooleanExtra("isReview", false));
//                startActivity(intent);
//                finish();

            } else {
                Intent intent2 = new Intent(this, LoginActivity.class);
                startActivity(intent2);
                finish();
            }
        }
    }
}
